package day2.set.demo3_stu;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.swing.border.EtchedBorder;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class Stu implements Comparable{
    String name;
    Integer age;

    @Override
    public int compareTo(Object o) {
        Stu s1 = (Stu) o;
        if(age-s1.age==0){
            return name.compareTo(s1.name);
        }
        return age-s1.age;
    }
}
